/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.ipccenter.toster.jpa;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.*;


/**
 *
 * @author 7
 */
@Entity @IdClass(AnswerID.class)
@Table(name = "ANSWERS")
public class JPAAnswer implements Serializable {
    private static final long serialVersionUID = 1L;
   //  @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id 
    @Column(name = "TC_ID") 
    private BigInteger tcId;
    @Id
    @Column(name = "ANS_NUM")
    private Short ansNum;
 
    
    @Lob
    @Column(name = "ANS_CONTENT")
    private String ansContent;
    
    
    @Column(name = "ISCORRECT")
    private Short iscorrect;
    @ManyToOne(optional = false, cascade=CascadeType.ALL)
    @JoinColumn(name = "TC_ID", insertable = false, updatable = false)
    private JPATestCase testcase;

    public JPAAnswer() {
    }

    public JPAAnswer(BigInteger tcId) {
        this.tcId = tcId;
    }

    public BigInteger getTcId() {
        return tcId;
    }

    public void setTcId(BigInteger tcId) {
        this.tcId = tcId;
    }

    public String getAnsContent() {
        return ansContent;
    }

    public void setAnsContent(String ansContent) {
        this.ansContent = ansContent;
    }

    public Short getAnsNum() {
        return ansNum;
    }

    public void setAnsNum(Short ansNum) {
        this.ansNum = ansNum;
    }

    public Short getIscorrect() {
        return iscorrect;
    }

    public void setIscorrect(Short iscorrect) {
        this.iscorrect = iscorrect;
    }

    public JPATestCase getTestcase() {
        return testcase;
    }

    public void setTestcase(JPATestCase testcase) {
        this.testcase = testcase;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tcId != null ? tcId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof JPAAnswer)) {
            return false;
        }
        JPAAnswer other = (JPAAnswer) object;
        if ((this.tcId == null && other.tcId != null) || (this.tcId != null && !this.tcId.equals(other.tcId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "toProj.Answers[ tcId=" + tcId + " ]";
    }
    
}
